home *** CD-ROM | disk | FTP | other *** search
- /*
- * +--------------------------------------------------------------------------+
- * | Copyright (c) 2009-10 Add This, LLC |
- * +--------------------------------------------------------------------------+
- * | This program is free software; you can redistribute it and/or modify |
- * | it under the terms of the GNU General Public License as published by |
- * | the Free Software Foundation; either version 3 of the License, or |
- * | (at your option) any later version. |
- * | |
- * | This program is distributed in the hope that it will be useful, |
- * | but WITHOUT ANY WARRANTY; without even the implied warranty of |
- * | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
- * | GNU General Public License for more details. |
- * | |
- * | You should have received a copy of the GNU General Public License |
- * | along with this program. If not, see <http://www.gnu.org/licenses/>. |
- * +--------------------------------------------------------------------------+
- */
-
- AddThis_Util.dbg("main: top");
-
-
- window.addEventListener("load", function() { AddThis.init(); }, false);
-
-
- var AddThis = {
-
- init: function() {
- AddThis_Util.dbg("main.init: entered");
-
- var firstrun = !AddThis_Util.getBooleanPref("extensions.addthis.init", false),
- upgrade = (AddThis_Util.getStringPref("extensions.addthis.session","")=="");
-
- if (firstrun) {
- AddThis_Util.dbg("main.init: first run");
- AddThis_Util.loadServiceDefaults();
- AddThis_Toolbar.setVisibility(true);
- AddThis_MainButton.setVisibility(false);
- AddThis_Util.setBooleanPref('extensions.addthis.urlbar.disable', true);
- AddThis_UrlBar.setVisibility(false);
- AddThis_ContextMenu.setVisibility(true);
- AddThis_Util.setBooleanPref("extensions.addthis.init", true);
- AddThis_Util.navToUrl(AddThis_Constants.WELCOME_URL);
- } else if (upgrade) {
- AddThis_Util.dbg("main.init: upgrade");
- AddThis_Toolbar.setVisibility(true);
- AddThis_Util.navToUrl(AddThis_Constants.WELCOME_URL);
- }
-
-
- AddThis_UrlBar.init();
- AddThis_Toolbar.init();
- AddThis_Toolbar.resizeDelay();
-
-
- AddThis_Search.init();
-
-
- var contextMenu = document.getElementById("contentAreaContextMenu");
- contextMenu.addEventListener("popupshowing", AddThis_ContextMenu.setVisibility,true);
- var toolsMenu = document.getElementById("menu_ToolsPopup");
- toolsMenu.addEventListener("popupshowing", AddThis_ToolsMenu.setVisibility,true);
- window.addEventListener("resize", AddThis_Toolbar.resizeDelay, true);
-
- AddThis_Util.png();
- if (firstrun || upgrade) {
- window.setTimeout(AddThis.showWelcome,1500);
- }
- AddThis_Util.dbg("main.init: exiting");
- },
-
- showPreferences: function() {
- AddThis_Util.dbg("showPreferences: popping window...");
- var w = window.openDialog('chrome://addthis/content/preferences.xul', 'AddThis Preferences', 'centerscreen,chrome,titlebar,toolbar');
- w.focus();
- },
-
- gotoFeedback: function()
- {
- AddThis_Util.navToUrl(AddThis_Constants.FEEDBACK_URL);
- },
-
- showAbout: function()
- {
- AddThis_Util.dbg("showAbout: popping window...");
- var w = window.openDialog('chrome://addthis/content/about.xul', '', 'centerscreen,chrome,titlebar,toolbar');
- w.focus();
- },
-
- showWelcome: function() {
- AddThis_Util.dbg("showWelcome: popping window...");
- var w = window.openDialog('chrome://addthis/content/welcome.xul', '', 'centerscreen,chrome,titlebar,toolbar,modal');
- w.focus();
- },
-
- gotoAddThis: function()
- {
- AddThis_Util.navToUrl("http://www.addthis.com");
- },
-
- shareAddon: function()
- {
- AddThis_Sharing.invokeService('more',AddThis_Constants.AMO_URL,AddThis_Constants.AMO_TITLE);
- }
-
- };
-
- AddThis_Util.dbg("main: done");
-
-